﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common
{
    /// <summary>
    /// TypeParse扩展类
    /// </summary>
   public static  class TypeParseExtensions
    {
       /// <summary>
       /// 
       /// </summary>
       /// <param name="obj"></param>
       /// <param name="defaultValue"></param>
       /// <returns></returns>
       public static int StrToInt(Object obj, int defaultValue)
       {
           return TypeParse.StrToInt(obj, defaultValue);
       }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="obj"></param>
       /// <param name="defaultVal"></param>
       /// <returns></returns>
       public static bool StrToBool(Object obj, bool defaultVal)
       {
           return TypeParse.StrToBool(obj, defaultVal);
       }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="obj"></param>
       /// <param name="defaultValue"></param>
       /// <returns></returns>
       public static string StrToString(Object obj,string defaultValue="")
       {
           return obj == null ? defaultValue : obj.ToString();
       }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="obj"></param>
       /// <param name="defaultValue"></param>
       /// <returns></returns>
       public static float StrToFloat(Object obj, float defaultValue)
       {
           return TypeParse.StrToFloat(obj, defaultValue);
       }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="obj"></param>
       /// <param name="defaultValue"></param>
       /// <returns></returns>
       public static DateTime StrToDateTime(Object obj, DateTime defaultValue)
       {
           return TypeParse.StrToDateTime(obj, defaultValue);
       }
    }
}
